import argparse


if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Process some integers.')
    parser.add_argument('--flag', default=True, action='store_false', help='A boolean flag')

    subparsers = parser.add_subparsers(title='subcommands',
                                       description='valid subcommands',
                                       help='additional help',
                                       dest='command')

    # First subcommand
    parser_a = subparsers.add_parser('a', help='subcommand a')
    parser_a.add_argument('integers', metavar='N', type=int, nargs='+',
                          help='an integer for the accumulator')
    parser_a.add_argument('--sum', dest='accumulate', action='store_const',
                          const=sum, default=max,
                          help='sum the integers (default: find the max)')

    # Second subcommand
    parser_b = subparsers.add_parser('b', help='subcommand b')
    parser_b.add_argument('--bar', type=int, help='bar help')

    # Third subcommand
    parser_c = subparsers.add_parser('c', help='subcommand c')
    parser_c.add_argument('--param', '-p', type=str, dest='param', default='abc', help='param c')
    # 针对type=bool的不能与action="store_true"同用
    parser_c.add_argument('--action', '-a', default=False, action="store_true", help="action")
    parser_c.add_argument('--bar1', type=int, help='bar1 help')

    args = parser.parse_args()
    print(args.command)
